Static Analysis of Software by Boulanger Jean-Louis; Boulanger Jean-Louis;

Static Analysis of Software by Boulanger Jean-Louis; Boulanger Jean-Louis;

Author:Boulanger, Jean-Louis; Boulanger, Jean-Louis;
Language: eng
Format: epub
ISBN: 1124674
Publisher: John Wiley & Sons, Incorporated
Published: 2013-01-18T16:00:00+00:00


4.6.2.1. Preliminary analysis of the application

The first stage of the static analysis of a source code is its “compilation” by the tool. To enable the compilation, we have taken into account the specificities of this application and configured Polyspace®, as described in Table 4.3.

Moreover, the Polyspace® compilation is stricter than the one carried out by common compilers, since it systematically verifies the respect of the ANSI/ISO C standard [ISO 90]. Thus, certain modifications have been brought to the application’s source code to correct the aspects that do not conform to ANSI C. Once this configuration is finished, the analysis of the application by Polyspace® is possible.

At this stage, the results show that the interruptions are not simulated. In particular, infinite loops were wrongly detected. We have deleted these cycles, which only delay the execution of the rest of the statements without changing their behavior. Then the analysis was correct but too expensive in terms of time.

Table 4.3. List of options necessary for the compilation

Polyspace®options Specificity of the application

-target i386

-OS-target no-predefined-OS

-I APPLICATIONS/WATCOMC_Includes Compiler WATCOMC

-dos The delimiter “\” is used instead of “/” in processed included file names

-discard-asm The assembly piece of code automatically skipped and stubbed

-DINTERRUPT=

-D far=

-DFAR= The “interruptions” and “far pointers” are skipped

We have then simplified the source code to enable a more efficient Polyspace® analysis. To reduce the number of pointers computed, we redefine functions without functional contribution (message logging), by associating a nohup semantic to them. We also replaced the Fatal_Fault, Fallback_ Position and Pseudo_ Fatal_Fault functions with definite stops of the execution. We also defined the function ALLOCATE_MEMORY to the standard malloc functions. By doing this, we divide the number of aliases calculated by Polyspace® by a factor of 5.8. Furthermore, we redefined the macro ASSERTION, which implants the control points, to a call to the assert function recognized by Polyspace®. During this preliminary work, were are able to detect and correct three run-time errors in the source code of the application.

Such adaptations are often necessary to make static analysis practicable at the source level because not all existing compiler extensions can be imbed in the analyzer and because some source code characteristics, such as the number of aliases, limit the efficiency of static tools.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.